<html>
<head>
	<title>调试面板</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link href="./css/aui.css" rel="stylesheet" type="text/css"/>
    <link href="./css/index.css" rel="stylesheet" type="text/css"/>
    <link href="./css/aui-iconfont.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="./js/api.js"></script>
	<script type="text/javascript" src="./js/socket.io-2.1.1.js"></script>
	<script type="text/javascript" src="./js/socket.js"></script>
</head>
<style type="text/css">
	#topbar{
		width: calc(100% - 30px);
	}
	#connect_status{
		z-index: 999;
		top:2px;
		right:0;
		position: fixed;  
		padding: 5px;
		border-radius: 5px 0 0 5px;
		color:#ffffff;
		background: #1E9FFF;
		cursor: pointer;
	}
	#connect_status i{
		margin-right: 3px;
	}
	.connect_status_error{
		background: #FF3355!important;
	}
	#frame{
		position: fixed;
		width: 100%;
		height: calc(100% - 75px);
		margin: 0;
		padding: 0;
		border: 0;
		bottom: 0;
		left: 0;
	}
</style>
<body>
	<div class="aui-col-xs-12">
	    <div class="aui-col-xs-12 aui-text-center" id="topbar">
	         
	    <div id="connect_status">
	         
	    </div>
	</div>
	<div class="panel">
		 <div id="statusTxt"></div>
	<!-- 	 <button onclick="updateData();">更新数据</button>
		 <button onclick="updateKlineData();">更新分时数据</button>
		 <button onclick="loadData();">加载数据</button>
		 <button onclick="GetStockInfoWork();">加载股票数据</button> -->
		 <button onclick="pullStaticWeb();">更新前端网站</button>
		 <div id="result"></div>
	 </div> 
</body>
<script type="text/javascript"> 
	$socket.init(function(status,msg){
		console.log(status,msg);
		var connect_status = $api.byId("connect_status");
		if(status){
			if($api.hasCls(connect_status,'connect_status_error')){
				$api.removeCls(connect_status,'connect_status_error');
			}
			$api.html(connect_status,'<i class="aui-iconfont aui-icon-check"></i>'+msg);
		}else{
			if(!$api.hasCls(connect_status,'connect_status_error')){
				$api.addCls(connect_status,'connect_status_error');
			}
			$api.html(connect_status,'<i class="aui-iconfont aui-icon-close"></i>'+msg);
		} 
	});
	
	 
 
	
	
	
	 var debug = true;//是否开启调试
	 
		$socket.message(function(data){
			console.log("接收消息:");
			console.log(data);
		});
		function loadData(){
			$socket.get('getQhInfos',{},function(status,data){
				if(status){
					$api.html($api.byId('result'),JSON.stringify(data));
					console.log(data);
				}else{ 
					console.log(data);
				}
			});
		}
		function updateData(){
			$socket.get('GetFutureInfoWork',{},function(status,data){
				if(status){
					$api.html($api.byId('result'),JSON.stringify(data));
					console.log(data);
				}else{ 
					console.log(data);
				}
			});
		}
		function updateKlineData(){
			$socket.get('GetFutureKlineWork',{},function(status,data){
				if(status){
					$api.html($api.byId('result'),JSON.stringify(data));
					console.log(data);
				}else{ 
					console.log(data);
				}
			});
		}
		
		function GetStockInfoWork(){
			$socket.get('GetStockInfoWork',{},function(status,data){
				if(status){
					$api.html($api.byId('result'),JSON.stringify(data));
					console.log(data);
				}else{ 
					console.log(data);
				}
			});
		}
		function pullStaticWeb(){
			$socket.get('pullStaticWeb',{},function(status,data){
				if(status){
					$api.html($api.byId('result'),JSON.stringify(data));
					console.log(data);
				}else{ 
					console.log(data);
				}
			});
		}
</script>
</html>